from google.appengine.ext import webapp
from google.appengine.ext.webapp.util import run_wsgi_app
from google.appengine.ext.webapp import template
from google.appengine.ext import db
import os
import datetime
import tables
from html import DropDown, Link

class Reset(webapp.RequestHandler):
    '''Class for the main page of links to get to the other pages'''
    def get(self):        
        for tableName in tables.names:
            db.delete(db.GqlQuery("SELECT * FROM " + tableName))
        self.response.out.write("Datastore cleared.")
        self.response.out.write('''
            <form action="/admin/reset" method="post">
            <input type="submit" name="submit" value="Enter Test Data">
            </form>
            ''')


    def post(self):
        import staticInits
        staticInits.setup()
        self.response.out.write("Test data entered.")
application = webapp.WSGIApplication([('/admin/reset', Reset)], debug=True)

def main():
    run_wsgi_app(application)

if __name__ == "__main__":
    main()
